import 'dart:ui';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';

void main(){
  runApp(MaterialApp(
    debugShowCheckedModeBanner: false,
    home: Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.blueGrey,
        title: const Text("你好Flutter",textDirection: TextDirection.ltr,
        style: TextStyle(
          color: Color.fromRGBO(255, 255, 255, 1),
        ),
        ),
      ),
      body:const Column(
        children: [
          // MyApp(),
          MyContainer(),
          MyButton(),
          MyText(),
          SizedBox(height: 10,),
          NetWorkImage(),
          SizedBox(height: 10,),
          LocalImage(),
          SizedBox(height: 10,),
          CircleImage(),
          ClipCoverImage()
        ],
      ),
    )
  ));
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const Center(
      child: Text(
        "你好Flutter",
        style: TextStyle(
          fontSize: 40,
          color: Colors.red
        ),
      ),
    );
  }
}
//Container容器
class MyContainer extends StatelessWidget {
  const MyContainer({super.key});

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
        width: 100,
        height: 100,
        alignment: Alignment.center,
        margin: const EdgeInsets.fromLTRB(0, 10, 0, 0),
        padding: const EdgeInsets.fromLTRB(0, 10, 0, 0),
        // transform: Matrix4.skewY(0.1),
        transform: Matrix4.rotationZ(0.1),
        decoration: BoxDecoration(
          color: Colors.red,
          borderRadius:BorderRadius.circular(10),
          border: Border.all(color: Colors.black,width: 2),
          gradient: const LinearGradient(
            colors: [Colors.red,Colors.yellow],
          ),
          boxShadow:const [BoxShadow(
            color: Colors.blueGrey,
            blurRadius:10,
          )]
        ),
        child: const Text(
          "我是Container",
          style: TextStyle(
              color: Colors.white
          ),
        ),
      ),
    );
  }
}
//按钮
class MyButton extends StatelessWidget {
  const MyButton({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 200,
      height: 40,
      alignment: Alignment.center,
      margin: const EdgeInsets.fromLTRB(0, 20, 0, 0),
      decoration: BoxDecoration(
        color: Colors.blue,
        borderRadius: BorderRadius.circular(20)
      ),
      child: const Text("按钮",style: TextStyle(
        color: Colors.white,
        fontSize: 18
      ),),
    );
  }
}
//文本
class MyText extends StatelessWidget {
  const MyText({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 40,
      width: 200,
      margin:const EdgeInsets.fromLTRB(0, 10, 0, 0),
      decoration: const BoxDecoration(
        color: Colors.green
      ),
      child: const Text("FlutterText,Flutter Text,Flutter Text,Flutter Text,Flutter Text,Flutter Text,Flutter Text",
        maxLines: 2,

        textAlign: TextAlign.left,
        // textScaler: TextScaler.linear(1),
        overflow: TextOverflow.ellipsis,

        style: TextStyle(
          fontSize: 12,
            // letterSpacing: 1,
            decoration: TextDecoration.underline,
            decorationColor: Colors.deepPurpleAccent,
            decorationStyle:TextDecorationStyle.wavy ,
            wordSpacing: 6,
            fontWeight: FontWeight.w900,
            fontStyle: FontStyle.italic,
            color: Colors.deepOrange
        ),),
    );
  }
}
//图片https://copyright.bdstatic.com/vcg/creative/cc9c744cf9f7c864889c563cbdeddce6.jpg@h_1280
class NetWorkImage extends StatelessWidget {
  const NetWorkImage({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 100,
      width: 100,
      decoration: const BoxDecoration(
        color: Colors.yellow,
      ),
      child: Image.network("https://copyright.bdstatic.com/vcg/creative/cc9c744cf9f7c864889c563cbdeddce6.jpg@h_1280",
        fit:BoxFit.cover,
      ),
    );
  }
}
//本地图片
class LocalImage extends StatelessWidget {
  const LocalImage({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      alignment: Alignment.centerLeft,
      height: 100,
      width: 100,
      decoration: const BoxDecoration(
        color: Colors.red,
      ),
      child: Image.asset("assets/images/animal.jpg",
      ),
    );
  }
}
//图片切圆
class CircleImage extends StatelessWidget {
  const CircleImage({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 100,
      width: 100,
      decoration:  BoxDecoration(
        borderRadius: BorderRadius.circular(50),
        color: Colors.yellow,
        image: const DecorationImage(image:AssetImage("assets/images/fruit.jpeg"),fit: BoxFit.cover
        )
      ),

    );
  }
}
//ClipCover圆
class ClipCoverImage extends StatelessWidget {
  const ClipCoverImage({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.fromLTRB(0, 10, 0, 0),
      decoration: const BoxDecoration(
        color: Colors.red,
      ),
      child: ClipOval(
        child: Image.network("https://inews.gtimg.com/om_bt/OHyQqgC_5oi4Vm0tlH49XvJzqNBHo2Zryxx5F_be5N2cIAA/1000",
        height: 100,
          width: 100,
          fit: BoxFit.cover,
        ),
      ),
    );
  }
}




